package info.gridworld.actor;

import info.gridworld.grid.Grid;
import info.gridworld.grid.Location;

public class DyingFlowerBug extends Bug{
	DyingFlowerBug(){
		super();
	}

	public static void main(String[] args) {
		ActorWorld world = new ActorWorld();
		world.add(new Location(8,8), new DyingFlowerBug());
		world.show();
	}

	@Override
	public void move(){
		Grid<Actor> gr = getGrid();
		if (gr == null)
			return;
		Location loc = getLocation();
		Location next = loc.getAdjacentLocation(getDirection());
		if (gr.isValid(next))
			moveTo(next);
		else
			removeSelfFromGrid();

		DyingFlower flower = new DyingFlower();
		flower.putSelfInGrid(gr, loc);
	}

}
